package com.freewater.cargotracker.domain.shared;

import org.apache.commons.lang3.Validate;

public class NotSpecification<T> extends AbstractSpecification<T> {

    private Specification<T> wrapped;

    public NotSpecification(Specification<T> specification) {
        Validate.notNull(specification, "Specification is required");
        this.wrapped = specification;
    }

    @Override
    public boolean isSatisfiedBy(T t) {
        return !wrapped.isSatisfiedBy(t);
    }
}
